class Solution {
public:
    double myPow(double x, int m) {
        long long n=m;
        if(n<0)
        {
            x=1/x;
            n=-n;
        } 
        if(n==0)
            return 1.0;
        double tmp=myPow(x,n/2);
       
        if(n%2==0)
        {
            return tmp*tmp;
        }
        else
            return tmp*tmp*x;
    }
};
